package servlet;

import entity.User;
import utils.FaceUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "FaceServlet")
public class FaceServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String opr=request.getParameter("opr");
        PrintWriter out=response.getWriter();
        if(opr.equals("reg")){
            String img = request.getParameter("img");
            User users = (User) request.getSession().getAttribute("user");
            String res = FaceUtil.faceadd(users.getId() + "", img, "kgc_group_1");
            out.print(res);
        }
    }
}
